#【练习】面向对象跑步减肥

class Person():
    def __init__(self,name,weight):
        self.name=name
        self.weight=weight
    def __str__(self):
        return f"{self.name}爱跑步,体重为{self.weight}公斤"
    def run(self):
        self.weight=self.weight-0.5
        print(f"{self.name} 在跑步，体重减少0.5公斤")
    def eat(self):
        self.weight=self.weight+1
        print(f"{self.name} 在吃东西,体重增加1公斤")

if __name__ == '__main__':
    XM=Person("小明",75)
    print(XM)
    XM.run()
    XM.eat()

    MM=Person("小美",45)
    print(MM)
    MM.eat()
    MM.run()